package com.Utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseUtils {
    private static final String DRIVER_NAME = "com.mysql.jdbc.Driver";
    private static final String URL = "jdbc:mysql://dphzmy-hv26g5r95lxqtql0-pub.proxy.dms.aliyuncs.com:3306/test";//数据库连接地址
    private static final String USER_NAME = "WVrn2DQ7STwVixjSkZ6rkBkc";//用户名
    private static final String PASSWORD = "JH7cqXBBmYmCp6qWrDOu2LkJ3ZazEu";//密码
    // Class.forName(DRIVER_NAME);
    public static Connection getSQLConnection() throws SQLException {
        try {
            Class.forName(DRIVER_NAME);
        } catch (ClassNotFoundException e) {
            System.out.println("Class.forName Error");
            e.printStackTrace();
        }
        return DriverManager.getConnection(URL, USER_NAME, PASSWORD);
    }
}
